BlueCielo Publisher 2012 Administrator's Guide | BlueCielo ECM Solutions

You are here: Registering documents for publication > Registering programmatically with the Task Server

Registering programmatically with the Task Server

To register documents with the Task Server, you submit a task to the Task Server from your code. You submit the task to the MeridianTask object that is instantiated by a Publisher extension for the PowerUser. That extension is registered as described in Configuring a Meridian Enterprise application server. The Task Server executes the task using the options of the publishing job that is specified by the publish code that you pass to the MeridianTask object. For information about programmatically registering documents without using the Task Server, see Registering programmatically without the Task Server.

Note Using the MeridianTask object requires the following:

To register documents using the Task Server:

  1. Implement code that sets at least the JobCode (publish code) property of a vault's Task object. Additional properties may be set, but are not required.
  1. Submit the Task object to the BCPublisher.MeridianTask class with the Submit method and pass a Document object as shown in the following examples. For more information about the MeridianTask object, see About the MeridianTask object.

The task can be submitted by any event or command where a Document object exists. For more information about the Submit method, see the BlueCielo Meridian Enterprise VBScript API Reference.

Note    In VBScript, you only have access to the current document; therefore, publishing tasks can only be created for the current document.

Example using Meridian Enterprise VBScript
Sub PublishCommand_Execute(Batch)
  ' Set arguments for the task.
  Vault.Task.Set "JobCode", "3BA9DF"
  Vault.Task.Set "FeedBackProperty", "Custom.PublishStatus"
  ' Register the current document for publishing.
  Vault.Task.Submit "BCPublisher.MeridianTask", Document  
End Sub
Example using a Meridian Enterprise VB.NET extension
Private Sub btnPublish_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  Handles btnPublish.Click

  ' Get the current document to publish.
  Dim document As BCDocument = ExtensionHost.CurrentObject

  ' Set arguments for the task.
  Dim task As BCSTask = ExtensionHost.ScriptObjects.Vault.Task
  task.Set("JobCode", "3BA9DF")
  task.Set("FeedbackProperty", "Custom.PublishStatus")

   ' Register the document for publishing.
  task.Submit("BCPublisher.MeridianTask", document)

End Sub
Example using a Meridian Enterprise VB.NET application (server API)
Private Sub DoIt(ByVal repository As BCRepository)
  ' Get document to publish.
  Dim document As BCDocument = repository.GetFSObject("\MyDocument.doc")

  Using taskServer As BCTaskServer = New BCTaskServer(repository.AMServer.AMTaskServerMachine)
    ' Set arguments for the task.
    Dim args As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
    args("JobCode") = "3BA9DF"
    args("FeedbackProperty") = "Custom.PublishStatus"

   ' Register the document for publishing.
    taskServer.SubmitTask( _
      "BCPublisher.MeridianTask", _
      args, _
      Nothing, _
      0, _
      document.ID, _
      Nothing, _
      Nothing, _
      Nothing, _
      Nothing) 
  End Using
End Sub
Example using a Meridian Enterprise VB.NET application (client API)
Private Sub DoIt(ByVal repository As BCRepository)
  ' Get document to publish.
  Dim document As BCDocument = repository.GetFSObject("\MyDocument.doc")

  Using services As BCServiceProvider = New BCServiceProvider(repository)
    Using metadata As BCSMetadata = New BCSMetadata(services)
      ' Set arguments for the task.
      Dim task As BCSTask = metadata.Vault.Task
      task.Set("JobCode", "3BA9DF")
      task.Set("FeedbackProperty", "Custom.PublishStatus")

      ' Register the document for publishing.
      task.Submit("BCPublisher.MeridianTask", document)
    End Using
  End Using
End Sub

Related concepts

Registering documents for publication

Related tasks

Registering on demand in Meridian Enterprise

Registering programmatically without the Task Server


Copyright © 2000-2012 BlueCielo ECM Solutions

www.bluecieloecm.com